package com.chujian.framework.sync.handler;

import com.chujian.framework.sync.SyncData;
import com.chujian.framework.sync.SyncDataFactory;
import com.chujian.framework.sync.SyncConst;

import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

public class DelHandler implements ISyncMethodHandler {

    @Override
    public String supportMethod() {
        return SyncConst.METHOD_DEL;
    }

    @Override
    public SyncData creSyncData(Method method, Object[] args, Object returnValue, Object target) {
        Long id = ((Long) args[0]);
        List<Long> ids = Collections.singletonList(id);
        return SyncDataFactory.creDeleteSyncData(target, ids);
    }
}
